import 'package:bruno/bruno.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:meal/constant/sizes.dart';
import 'package:meal/route/route.dart';
import 'package:meal/utils/colors.dart';
import 'package:meal/utils/styles.dart';
import 'package:meal/utils/tools.dart';

///
/// 使用记录
///
class MarketUseRecord extends StatefulWidget {
  const MarketUseRecord({Key? key}) : super(key: key);

  @override
  State<MarketUseRecord> createState() => _MarketUseRecordState();
}

class _MarketUseRecordState extends State<MarketUseRecord> {
  TextStyle get defaultStyle {
    return StylesUtils.customTextStyle(color: ColorsUtils.color797, fontSize: Sizes.default12);
  }

  TextStyle get style {
    return StylesUtils.customTextStyle(color: ColorsUtils.color333);
  }

  @override
  Widget build(BuildContext context) {
    return SingleChildScrollView(
      child: Column(
        children: [
          Container(
            margin: const EdgeInsets.all(Sizes.default20),
            decoration: BoxDecoration(
                color: Colors.white, borderRadius: BorderRadius.circular(Sizes.default10)),
            padding:
                const EdgeInsets.symmetric(vertical: Sizes.default10, horizontal: Sizes.default15),
            child: ListBody(
              children: [
                BrnDashedLine(
                  contentWidget: Column(
                    children: [
                      Container(
                        alignment: Alignment.centerLeft,
                        height: Sizes.default30,
                        child: Text(
                          '订单编号：12232964103521',
                          style: defaultStyle,
                        ),
                      ),
                      Container(
                        alignment: Alignment.centerLeft,
                        height: Sizes.default30,
                        child: Text(
                          '优惠金额：￥50',
                          style: defaultStyle,
                        ),
                      ),
                      Container(
                        alignment: Alignment.centerLeft,
                        padding:
                            const EdgeInsets.only(bottom: Sizes.default20, top: Sizes.default10),
                        child: Text(
                          '下单时间：2023-01-12 12:14:46',
                          style: defaultStyle,
                        ),
                      ),
                    ],
                  ),
                  color: ColorsUtils.parseColorFromHexString('#D7D7D7'),
                  dashedOffset: Sizes.default5,
                  dashedLength: Sizes.default6,
                  dashedSpacing: Sizes.default3,
                  position: BrnDashedLinePosition.trailing,
                ),
                Container(
                    alignment: Alignment.centerLeft,
                    height: Sizes.default30,
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: [
                        TextButton(
                          onPressed: gotoView,
                          child: Text(
                            '查看订单详情',
                            style: defaultStyle,
                          ),
                        ),
                        ToolsUtils.iconRightArrow(Sizes.default13, Sizes.default13)
                      ],
                    ))
              ],
            ),
          ),
          Container(
            margin: const EdgeInsets.only(left: Sizes.default20, right: Sizes.default20, bottom: Sizes.default20),
            decoration: BoxDecoration(
                color: Colors.white, borderRadius: BorderRadius.circular(Sizes.default10)),
            padding:
            const EdgeInsets.symmetric(vertical: Sizes.default10, horizontal: Sizes.default15),
            child: ListBody(
              children: [
                BrnDashedLine(
                  contentWidget: Column(
                    children: [
                      Container(
                        alignment: Alignment.centerLeft,
                        height: Sizes.default30,
                        child: Text(
                          '订单编号：12232964103521',
                          style: defaultStyle,
                        ),
                      ),
                      Container(
                        alignment: Alignment.centerLeft,
                        height: Sizes.default30,
                        child: Text(
                          '优惠金额：￥50',
                          style: defaultStyle,
                        ),
                      ),
                      Container(
                        alignment: Alignment.centerLeft,
                        padding:
                        const EdgeInsets.only(bottom: Sizes.default20, top: Sizes.default10),
                        child: Text(
                          '下单时间：2023-01-12 12:14:46',
                          style: defaultStyle,
                        ),
                      ),
                    ],
                  ),
                  color: ColorsUtils.parseColorFromHexString('#D7D7D7'),
                  dashedOffset: Sizes.default5,
                  dashedLength: Sizes.default6,
                  dashedSpacing: Sizes.default3,
                  position: BrnDashedLinePosition.trailing,
                ),
                Container(
                    alignment: Alignment.centerLeft,
                    height: Sizes.default30,
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: [
                        TextButton(
                          onPressed: gotoView,
                          child: Text(
                            '查看订单详情',
                            style: defaultStyle,
                          ),
                        ),
                        ToolsUtils.iconRightArrow(Sizes.default13, Sizes.default13)
                      ],
                    ))
              ],
            ),
          ),
          Container(
            margin: const EdgeInsets.only(left: Sizes.default20, right: Sizes.default20, bottom: Sizes.default20),
            decoration: BoxDecoration(
                color: Colors.white, borderRadius: BorderRadius.circular(Sizes.default10)),
            padding:
            const EdgeInsets.symmetric(vertical: Sizes.default10, horizontal: Sizes.default15),
            child: ListBody(
              children: [
                BrnDashedLine(
                  contentWidget: Column(
                    children: [
                      Container(
                        alignment: Alignment.centerLeft,
                        height: Sizes.default30,
                        child: Text(
                          '订单编号：12232964103521',
                          style: defaultStyle,
                        ),
                      ),
                      Container(
                        alignment: Alignment.centerLeft,
                        height: Sizes.default30,
                        child: Text(
                          '优惠金额：￥50',
                          style: defaultStyle,
                        ),
                      ),
                      Container(
                        alignment: Alignment.centerLeft,
                        padding:
                        const EdgeInsets.only(bottom: Sizes.default20, top: Sizes.default10),
                        child: Text(
                          '下单时间：2023-01-12 12:14:46',
                          style: defaultStyle,
                        ),
                      ),
                    ],
                  ),
                  color: ColorsUtils.parseColorFromHexString('#D7D7D7'),
                  dashedOffset: Sizes.default5,
                  dashedLength: Sizes.default6,
                  dashedSpacing: Sizes.default3,
                  position: BrnDashedLinePosition.trailing,
                ),
                Container(
                    alignment: Alignment.centerLeft,
                    height: Sizes.default30,
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: [
                        TextButton(
                          onPressed: gotoView,
                          child: Text(
                            '查看订单详情',
                            style: defaultStyle,
                          ),
                        ),
                        ToolsUtils.iconRightArrow(Sizes.default13, Sizes.default13)
                      ],
                    ))
              ],
            ),
          ),
          Container(
            padding: const EdgeInsets.symmetric(vertical: 15),
            alignment: Alignment.center,
            child: Text(
              '- 已显示全部数据 -',
              style: StylesUtils.customTextStyle(
                  color: ColorsUtils.color797, fontSize: Sizes.default15),
            ),
          )
        ],
      ),
    );
  }

  void gotoView() {
    Get.toNamed(RouteGet.orderInfo);
  }
}
